package tvuong.gsb;

import modele.DAO;
import android.app.ListActivity;
import android.content.Intent;

import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;

public class GSBapp extends ListActivity {

    //lecture des noms
    List<String> lesNums = DAO.getLesDeps();

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lesNums);
        setListAdapter(adapter);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        Toast.makeText(getApplicationContext(), "Departement " + lesNums.get(position), Toast.LENGTH_LONG).show();
        Intent inter = new Intent(this, ListeMed.class);
        inter.putExtra("leNum", lesNums.get(position));
        startActivity(inter);
    }
}

